<?php

class BonusAccountTransferCashAccount extends DataObject implements PermissionProvider {
    private static $singular_name = "E-Bonus Transfer E-Cash";
    private static $plural_name = "E-Bonus Transfer E-Cash";
    
    private static $extensions = array("AccountTransfer");

	static function create_statement($data, $memberid, $transferid){
		if(!$memberid) {
            throw new Exception("Empty memberid");
        } else if(!$transferid) {
            throw new Exception("Empty transferid");
        }
		
        return BonusAccountTransferCashAccount::create()->update($data)->setField('MemberID', $memberid)->setField('TransferID', $transferid)->write();
    }

    function canView($member = false) {
        $extended = $this->extendedCan(__FUNCTION__, $member);
        if($extended !== null) {
            return $extended;
        }
        return Permission::check('VIEW_BonusAccountTransferCashAccount');
    }

    function canEdit($member = false) {
        return false;
    }

    function canDelete($member = false) {
        return false;
    }

    function canCreate($member = false) {
        return false;
    }

    public function providePermissions() {
        return array(
            'VIEW_BonusAccountTransferCashAccount' => array(
                'name' => _t('BonusAccountTransferCashAccount.PERMISSION_VIEW', 'Allow view access right'),
                'category' => _t('BonusAccountTransferCashAccount.PERMISSIONS_CATEGORY', 'E-Bonus Transfer E-Cash')
            )
        );
    }
}
?>